package com.zt.springkafka;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringKafkaApplication implements CommandLineRunner {

    @Autowired
    KafkaSender kafkaSender;

    public static void main(String[] args) {

        SpringApplication.run(SpringKafkaApplication.class, args);

    }


    @Override
    public void run(String... args) throws Exception {
        Event event = new Event().setTopic("test").setId(1).setMessage("msg");
        kafkaSender.sendMsg(event);
    }
}
